/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

/**
 * 业务员管理菜单
 *  */
// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';
import { responseRandom, ResponseItem, responseSuccess } from './utils';
import type { TableColumns, SearchParams } from '@/pages/OperatorManagement/types/WsPartner';
import type { AdvTableListItem, AdvLogType } from '@/pages/OperatorManagement/types/Advertisements';
import dayjs from 'dayjs';
import Mock, { mock } from 'mockjs';

Mock.Random.extend({
  phone: function () {
    const prefixs = ['132', '134', '150'];
    return this.pick(prefixs) + Mock.mock(/\d{8}/);
  },
});

function getList(req: Request, res: Response, u: string, tableList: Array<any>) {
  let realUrl = u;
  if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
    realUrl = req.url;
  }
  const { page = 1, pageSize = 10 } = req.body;
  const params = req.body as unknown as SearchParams;

  let dataSource = [...tableList].slice(
    ((page as number) - 1) * (pageSize as number),
    (page as number) * (pageSize as number),
  );

  const result: ResponseItem = {
    code: 0,
    msg: '',
    data: {
      list: dataSource,
      total: tableList.length.toString(),
      pageSize,
      page: parseInt(`${params.page}`, 10).toString() || '1',
    },
  };

  return res.json(result);
}

const getWsPartnerList = (page: number, pageSize: number) => {
  const tableList: TableColumns[] = [];
  for (let i = 0; i < pageSize; i += 1) {
    const index = (page - 1) * 10 + i;
    tableList.push({
      id: `${index}`,
      cm_id: `${index}`,
      third_order_id: `${index}132订单号`,
      third_name: `${index}商家名称`,
      third_mark: `${index}电商平台`,
      img: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
      price: 800,
      settlement_amount: 500,
      status: index % 3 ? '2' : index % 2 ? '0' : '1',
      reason: '拒绝原因',
      realname: `${index}快递员姓名`,
      mobile: `${index}快递员账号`,
      current_user: `${index}当前用户`,
      create_time: `${dayjs().format('YYYY-MM-DDTHH:mm:ss')}`,
      update_time: `${dayjs().format('YYYY-MM-DDTHH:mm:ss')}`,
      audit_time: `${dayjs().format('YYYY-MM-DDTHH:mm:ss')}`,
    });
  }
  return tableList;
};

const getAdvList = (page: number, pageSize: number) => {
  const tableList: AdvTableListItem[] = [];
  for (let i = 0; i < pageSize; i += 1) {
    const index = (page - 1) * 10 + i;
    tableList.push({
      id: `${index}`,
      platform: index % 2 ? '1' : '2',
      brand: index % 2 ? 'kb' : 'cn',
      name: '广告名称',
      custom_area_words: '自定义区域文字',
      custom_area_url:
        'pages/webview-redirect/webview-redirect?url=https://s.click.ele.me/JaJnLsu,2018090761255717',
      ad_area_img:
        'https://osscdn-kbad.kuaidihelp.com/admin/ad/2021/06/18/60cc6898992be/banner4.jpg',
      ad_area_url:
        'pages/webview-redirect/webview-redirect?url=https://s.click.ele.me/JaJnLsu,2018090761255717',
      status: index % 3 == 0 ? '1' : index % 3 == 1 ? '2' : '3',
      note: '备注',
      created_at: '2021-07-05 13:59:55',
      updated_at: '2021-07-05 14:00:47',
      creator: '创建人',
      is_plan: index % 2 ? '0' : '1',
    });
  }
  return tableList;
};

const getAdvLogList = (page: number, pageSize: number) => {
  const tableList: AdvLogType[] = [];
  for (let i = 0; i < pageSize; i += 1) {
    const index = (page - 1) * 10 + i;
    tableList.push({
      id: `${index}`,
      ad_id: '343',
      ad_name: '广告标题',
      action: '删除广告',
      created_at: '2021-07-08 10:14:16',
      operator: '15266667777',
    });
  }
  return tableList;
};

const todoList = getWsPartnerList(1, 15);
const advList = getAdvList(1, 40);

export default {
  // 微商合伙人
  'POST /KdyInviteVhomeRewards/list': (req: Request, res: Response, u: string) =>
    getList(req, res, u, todoList),
  'POST /KdyInviteVhomeRewards/set': (req: Request, res: Response) => responseRandom(req, res, {}),
  'POST /KdyInviteVhomeRewards/thirdMarkList': (req: Request, res: Response, u: string) => {
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        pdd: {
          name: '拼多多',
          url: 'https://fuwu.pinduoduo.com/service-market/service-detail?detailId=192',
        },
        yz: { name: '有赞', url: 'https://yingyong.youzan.com/cloud-app-detail/41956/info' },
        lb: {
          name: '抖音',
          url: 'https://fuwu.jinritemai.com/detail?from=fuwu_market_tab&service_id=18',
        },
        ks: { name: '快手', url: 'https://fuwu.kwaixiaodian.com/detail?id=670391339554' },
      },
    };
    return res.json(result);
  },
  // 面单广告位，获取广告列表
  'POST /CloudPrintAd/list': (req: Request, res: Response, u: string) =>
    getList(req, res, u, advList),
  // 删除广告
  'POST /CloudPrintAd/remove': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 广告上线
  'POST /CloudPrintAd/status': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 面单广告，发布广告
  'POST /CloudPrintAd/create': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 面单广告，编辑广告
  'POST /CloudPrintAd/modify': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 面单广告，复制广告
  'POST /CloudPrintAd/copy': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 面单广告，上传图片
  'POST /CloudPrintAd/upload': (req: Request, res: Response, u: string) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: 'http://upload.kuaidihelp.com/admin/coud_print_ad/2021_07/05/160e2b694d31ef118532408.jpg',
    };
    return res.json(result);
  },
  // 面单广告，预览面单
  'POST /CloudPrintAd/preview': (req: Request, res: Response, u: string) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: 'http://upload.kuaidihelp.com/admin/coud_print_ad/2021_07/05/160e2b694d31ef118532408.jpg',
    };
    return res.json(result);
  },
  // 面单广告，日志列表
  'GET /CloudPrintAd/logs': (req: Request, res: Response, u: string) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: {
        list: getAdvLogList(1, 20),
        total: 40,
        page: 1,
        pageSize: 20,
      },
    };
    return res.json(result);
  },
  // 控量广告位列表
  'POST /CloudPrintAdPlan/showPlan': (req: Request, res: Response, u: string) => {
    const data = Mock.mock({
      'list|1-10': [
        {
          'id|+1': 1,
          plan_id: '100',
          plan_name: '控量测试2',
          ad_id: '200',
          plan_count: '5',
          actual_count: '0',
          deleted_at: null,
          is_daily: '1',
          plan_begin_date: '2021-12-22 00:00:00',
          plan_end_date: '2021-12-29 23:59:59',
          'plan_status|1-2': 2,
          remark: '备注信息',
          created_at: '2021-12-24 16:11:00',
          updated_at: '2021-12-24 16:28:02',
          creator: '17606137848',
          plan_date: ['2021-12-24 16:11:00', '2021-12-24 16:28:02'],
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data.list,
    };
    return res.json(result);
  },
  'POST /CloudPrintAdPlan/updateDataGet': (req: Request, res: Response) => {
    const data = Mock.mock({
      plan_id: '1',
      plan_name: '控量测试2',
      ad_id: '44',
      plan_count: '5',
      actual_count: '0',
      deleted_at: null,
      is_daily: '1',
      plan_begin_date: '2021-12-22 00:00:00',
      plan_end_date: '2021-12-29 23:59:59',
      plan_status: '1',
      remark: '备注信息',
      created_at: '2021-12-24 16:11:00',
      updated_at: '2021-12-24 16:28:02',
      creator: '17606137848',
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data,
    };
    return res.json(result);
  },
  // 面单控量广告，复制广告
  'POST /CloudPrintAdPlan/copyPlan': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 广告上下线删除
  'POST /CloudPrintAdPlan/updateStatus': (req: Request, res: Response) =>
    responseRandom(req, res, {}),
  // 添加&编辑面单控量广告
  'POST /CloudPrintAdPlan/compilePlan': (req: Request, res: Response) =>
    responseRandom(req, res, {}),
  // 获取下线广告位列表
  'POST /CloudPrintAdPlan/offlineAdInfo': (req: Request, res: Response) => {
    const data = Mock.mock([
      {
        id: '22',
        platform: '2',
        brand: 'kb',
        name: '方的攻势的',
        custom_area_words: '',
        custom_area_url: '',
        ad_area_img:
          'http://upload.kuaidihelp.com/admin/coud_print_ad/2021_07/09/160e7a9694a047264506948.png',
        ad_area_url: 'https://www.baidu.com/',
        status: '2',
        note: '是的',
        created_at: '2021-07-09 09:42:08',
        updated_at: '2021-07-12 16:12:00',
        deleted_at: null,
        creator: '15179185977',
      },
    ]);

    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data,
    };
    return res.json(result);
  },

  'POST /wkd/WkdOrderMonitor/lists': (req: Request, res: Response) => {
    const data = Mock.mock({
      page_num: 1,
      page_size: 20,
      total: 100,
      'data|20': [
        {
          order_id: '@id',
          waybill_no: '4843153486',
          channel: 'aliapp',
          order_type: '9',
          order_status: '已发货',
          order_cancel_msg: '',
          order_created_at: '2020-08-10 15:58:08',
          collect_shop_name: '',
          collect_courier_name: '',
          real_collect_courier_mobile: '',
          third_party_orderid: '508105748800001',
          receive_start_time: '2020-08-10 15:58:08',
          receive_end_time: '2020-08-10 18:58:08',
          collect_date: '2020-08-10 19:31:00',
          collect_status: '3',
          shipper_uid: '1950998',
          shipper_name: '黄生12',
          shipper_mobile: '15201736791',
          shipper_province: '上海市',
          shipper_city: '上海市',
          shipper_district: '松江区',
          shipping_name: '公众号',
          shipping_mobile: '15201736791',
          shipping_province: '上海',
          shipping_city: '上海',
          shipping_district: '长宁',
          shipping_address: '同协路269号',
          package_info: '日用品',
          package_weight: '0.00',
          help_status: '3',
          sign_status: '1',
          sign_date: null,
          charging_weight: '0',
          customer_price: '8.00',
          actual_price: '0.00',
          pay_status: '3',
          pay_date: '2020-08-10 06:10:00',
          pay_type: '2',
          pay_merchant_no: '12321312',
          pay_order_no: '1231231',
          send_date: '2020-08-10 19:31:00',
          expected_collect_date: '2020-08-10 15:58:08 ~ 2020-08-10 18:58:08',
          order_vas: '智能匹配优质快递品牌服务',
          claiming_value: 0,
          charging_price: 0,
          order_profit: 0,
          welfare_money: 0,
          welfare_type: '',

          'freight_price|1-100.1-2': 1,
          'packing_money|1-100.1-2': 1,
          'other_money|1-100.1-2': 1,
          'refund_amount|1': ['123', ''],
          'refund_time|1': ['123', ''],
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: '错误',
      data: data,
    };
    return res.json(result);
  },
  'POST /wkd/WkdOrderMonitor/getLogisticsTrack': (req: Request, res: Response) => {
    const data = Mock.mock([
      '2月15号 理工男 深圳但 返回的撒过很多死啊u回复低俗',
      '2月15号 理工男 深圳但 返回的撒过很多死啊u回复低俗',
      '2月15号 理工男 深圳但 返回的撒过很多死啊u回复低俗',
      '2月15号 理工男 深圳但 返回的撒过很多死啊u回复低俗',
      '2月15号 理工男 深圳但 返回的撒过很多死啊u回复低俗',
    ]);
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data,
    };
    return res.json(result);
  },

  'POST /wkd/WkdOrderMonitor/getQueryConfig': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: 'success',
      data: {
        channel: {
          aliapp: '支付宝小程序',
          mina: '微信小程序',
          baiduapp: '百度小程序',
          huawei_quickapp: '华为快应用',
          vhome_yhj: '微掌柜',
          app: '微快递app',
          kop: '开放平台',
          corp_wechat: '企业微快递',
        },
        order_status: {
          '0': '已下单',
          '2': '已受理',
          '8': '已发货',
          '9': '运输中',
          '10': '派件中',
          '11': '已签收',
          '-9': '已取消',
          '-20': '已退款',
        },
        receive_status: ['未接单', '正常接单', '超时接单', '超时未接单'],
        collect_status: ['未揽收', '正常揽收', '超时揽收', '超时未揽收'],
        help_status: {
          '1': '未助力',
          '2': '助力中',
          '3': '助力成功',
          '4': '助力失败',
        },
        pay_status: ['未支付', '支付中', '支付成功', '支付失败'],
        pay_type: {
          '1': '线下支付',
          '2': '微信支付分',
          '5': '支付宝芝麻信用',
          '6': '协议客户支付',
        },
      },
    });
  },
  'POST /wkd/WkdOrderMonitor/setMonitorConfig': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: {},
    };
    return res.json(result);
  },

  'POST /wkd/WkdOrderMonitor/getMonitorConfig': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: {
        hour: 5,
        brand: ['jd', 'sto', 'jdyj'],
      },
    };
    return res.json(result);
  },

  'POST /wkd/WkdOrderMonitor/createExportTask': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: {},
    };
    return res.json(result);
  },
  'POST /wkd/Blacklist/getBrandList': (req: Request, res: Response) => {
    return res.json(
      mock({
        code: 0,
        data: [
          { brand: 'yjkd', order_type: 2, name: '申通优寄', nickname: '官方申通优寄（线上）' },
          { brand: 'jd', order_type: 3, name: '京东快递', nickname: '京东快递（线下）' },
        ],
        msg: 'success',
      }),
    );
  },
  'POST /wkd/WkdOrderMonitor/exportTaskLists': (req: Request, res: Response) => {
    const data = Mock.mock({
      'data|1-20': [
        {
          created_at: '@date',
          status_desc: '@csentence(3)',
          file_path: '@url',
          'status|1': [2, 1],
        },
      ],
    });
    console.log('data', data);
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data,
    };
    return res.json(result);
  },
  'POST /order/cancel': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: {},
    };
    return res.json(result);
  },
  'POST /BlackPullingDeviceManage/searchPhoneDevice': (req: Request, res: Response) => {
    const data = Mock.mock([
      {
        id: '@id()',
        device_id: 'VASDDA_DA&DHAS_76asdasd',
        device_model: 'iphone nokia oppo',
        device_phone: '@id()',
        reason: '@cname()',
        by_user: '@cname()',
        'platform_flag|1': ['yz', 'kdy', 'other'],
        'source|1': ['device', 'sms'],
        created_at: '@now()',
      },
    ]);

    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: { list: data, page: 'NaN', pageSize: 10, count: '30' },
    };
    return res.json(result);
  },
  'POST /BlackPullingDeviceManage/getPullingBlackLog': (req: Request, res: Response) => {
    const str = {
      code: 0,
      msg: '请求成功',
      data: Mock.mock({
        count: '100',
        current_page: '1',
        'list|1-30': [
          {
            id: '@id()',
            kb_id: '@id()',
            cm_id: '@id()',
            device_id: '186910e1-1687-3e44-b13b-03db7f20e850',
            device_model: '未知',
            device_phone: '13783636923',
            reason: '@cname()',
            by_user: '@cname()',
            created_at: '2022-03-24 17:15:15',
            oprate_desc: '',
            is_in_black: true,
            'platform_flag|1': ['yz', 'kdy', 'other'],
            'source|1': ['device', 'sms'],
          },
        ],
      }),
    };
    return res.json(str);
  },
  'POST /BlackPullingDeviceManage/operatePullingBlack': (req: Request, res: Response) =>
    responseRandom(req, res, {}),
  'POST /Brand/getApplicationList': (req: Request, res: Response) => {
    const data = Mock.mock({
      total: '1',
      page: 1,
      size: 10,
      'list|1-30': [
        {
          id: '2',
          cm_id: '2127890',
          brand: 'yt',
          type: '7',
          open_status: '1',
          open_result: '',
          approve_status: '1',
          approve_time: '',
          operator_phone: '',
          reject_reason_type: '0',
          reject_reason_desc: '',
          create_time: '2022-03-07 15:47:44',
          update_time: '2022-03-07 15:47:44',
          inn_name: '虹桥一号驿站',
          phone: '15179185977',
          concat_phone: '0797-5396954',
          concat_location: '通协路52熊猫',
          is_auth_realname: 1,
          business_audit_status: 1,
          brand_cn: '圆通',
          approve_status_desc: '待审核',
          cm_phone: '@id()',
          kb_id: '@id()',
        },
      ],
    });

    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data,
    };
    return res.json(result);
  },
  'POST /Brand/getApplicationInfo': (req: Request, res: Response) => {
    const data = {
      inn_info: {
        id: '1',
        cm_id: '2127890',
        brand: 'yt',
        type: '7',
        open_status: '1',
        open_result: 'success',
        approve_status: '2',
        approve_time: '2022-03-07 17:51:28',
        operator_phone: '18812345678',
        reject_reason_type: '0',
        reject_reason_desc: '',
        create_time: '2022-03-07 14:12:48',
        update_time: '2022-03-07 17:49:06',
        inn_name: '虹桥一号驿站',
        full_location: '上海市',
        phone: '15179185977',
        concat_phone: '0797-5396954',
        register_time: '2020-04-07 17:19:46',
        apply_time: '2022-03-07 14:12:48',
        is_auth_realname: 1,
        business_audit_status: 1,
        brand_cn: '圆通',
      },
      inn_stat: {
        today_in_num: 10,
        today_out_num: 10,
        today_back_num: 10,
        storage_num: 10,
        yesterday_in_num: 10,
        yesterday_out_num: 10,
        yesterday_back_num: 10,
        out_rate_day_1: 20.3,
        out_rate_day_3: 50.2,
        out_rate_day_7: 99.1,
      },
    };
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data,
    };
    return res.json(result);
  },
  'POST /Brand/processApplication': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /OperateLog/getList': (req: Request, res: Response) => {
    const data = {
      total: '4',
      page: 1,
      size: 10,
      list: [
        {
          id: '5',
          cm_id: '2127890',
          title: '开通品牌',
          type: '3',
          content: '开通申通驿站代收',
          create_time: '2022-03-25 00:33:24',
        },
        {
          id: '4',
          cm_id: '2127890',
          title: '开通品牌',
          type: '1',
          content: '开通圆通驿站代收',
          create_time: '2022-03-24 23:57:29',
        },
        {
          id: '3',
          cm_id: '2127890',
          title: '修改信息',
          type: '1',
          content: '15179185977修改地址为10001号',
          create_time: '2022-03-24 23:48:55',
        },
        {
          id: '2',
          cm_id: '2127890',
          title: '注册',
          type: '1',
          content: '15179185977注册成功',
          create_time: '2022-03-24 23:27:35',
        },
      ],
    };
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data,
    };
    return res.json(result);
  },
  // 驿站经营信息审核列表
  'POST /InnAudit/innAuditList': (req: Request, res: Response) => {
    const { page, limit = 10, type } = req.body;

    const data = Mock.mock({
      [`audits|${Math.max(limit, 2)}`]: [
        {
          'business_score|+1': 1,
          'id|+1': 1,
          'cm_id|+1': 1,
          inn_name: '旺角驿站测试环境1',
          league_name: '新零售加盟商测试dxx',
          phone: '@phone',
          status: type,
          update_time: '@datetime',
          operator: '@cname',
        },
      ],
      count: 100,
      page,
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data,
    };
    return res.json(result);
  },
  // 驿站经营信息详情
  'POST /InnAudit/innAuditDetailt': (req: Request, res: Response) => {
    const { id } = req.body;

    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        audit: {
          id,
          cm_id: '1614735',
          phone: '15818732277',
          status: '1',
          business_score: '6',
          update_time: '2021-11-16 16:19:01',
          cmInfo: {
            phone: '15818732277',
            inn_name: `通协小区便利店${id}`,
            league_name: `所属加盟商${id}`,
          },
        },
        detail: [
          {
            id: '81',
            cm_id: '1614735',
            type: '1',
            status: '1',
            img: '["http:\\/\\/upload.kuaidihelp.com\\/business\\/img\\/2020_10\\/23\\/15f9246b1e2b24815325276.jpg"]',
            update_time: '2020-11-06 13:53:16',
          },
          {
            id: '82',
            cm_id: '1614735',
            type: '2',
            status: '3',
            img: '["http:\\/\\/upload.kuaidihelp.com\\/business\\/img\\/2020_10\\/23\\/15f9246b1e2c41695476729.jpg","http:\\/\\/upload.kuaidihelp.com\\/business\\/img\\/2020_10\\/23\\/15f9246b1e2cae826001964.jpg"]',
            update_time: '2020-11-06 13:53:17',
          },
          {
            id: '83',
            cm_id: '1614735',
            type: '3',
            status: '3',
            img: '["http:\\/\\/upload.kuaidihelp.com\\/business\\/img\\/2020_10\\/23\\/15f9246b1e2d28471386291.jpg"]',
            update_time: '2020-11-06 13:53:18',
          },
          {
            id: '84',
            cm_id: '1614735',
            type: '4',
            status: '3',
            img: '["http:\\/\\/upload.kuaidihelp.com\\/business\\/img\\/2020_10\\/23\\/15f9246b1e2d28471386291.jpg"]',
            update_time: '2020-11-06 13:53:19',
          },
        ],
      },
    };
    return responseSuccess(req, res, result);
  },
  // 驿站经营信息详情，审核通过或拒绝
  'POST /InnAudit/actSaveDetail': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 驿站经营信息详情，审核下一条
  'POST /InnAudit/innNextDetail': (req: Request, res: Response) =>
    responseSuccess(req, res, {
      msg: 'success',
      data: `${Math.floor(Math.random() * 100)}`,
    }),

  // 入库返现列表
  'POST /Inn/getCashBackList': (req: Request, res: Response) => {
    const { page = 1 } = req.body;
    const data = Mock.mock({
      'list|20': [
        {
          'id|+1': 1,
          cm_id: '2127890',
          inn_name: '虹桥一号驿站',
          phone: '@phone',
          concat_phone: '@phone',
          join_date: '@date',
          total_amount: '@integer(0, 100)',
          already_cashback: '@integer(0, 100)',
          last_month_usage: '@integer(0, 1000)',
          this_month_cashback: '@integer(0, 1000)',
          this_month_usage: '@integer(0, 1000)',
          next_month_cashback: '@integer(0, 1000)',
          'status|1': [0, 1],
        },
      ],
      page,
      pageSize: 20,
      total: 60,
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data,
    };
    return responseSuccess(req, res, result);
  },
  // 入库返现列表，添加
  'POST /Inn/updateCashBackInfo': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 入库返现列表，发放
  'POST /Inn/releaseCash': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 入库返现列表，操作状态
  'POST /Inn/updateCashBackStatus': (req: Request, res: Response) => responseRandom(req, res, {}),
  // 入库返现列表，检查是否已参加活动
  'POST /Inn/getCashBackInfo': (req: Request, res: Response) => {
    const data = Mock.mock({
      id: '2',
      cm_id: '2127890',
      inn_name: '虹桥一号驿站',
      phone: '15179185977',
      join_date: '2022-12-06',
      total_amount: '@integer(0, 2000)',
      total_reward: '@integer(0, 2000)',
      'status|1': [0, 1],
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data,
    };

    return responseSuccess(req, res, result);
  },
  // 入库返现列表，检查上个月的可发放金额
  'POST /Inn/getReleaseInfo': (req: Request, res: Response) => {
    const data = Mock.mock({
      batch: '@date',
      inn_count: '@integer(0, 2000)',
      'reward_amount|1': ['0.00', '@integer(0, 2000)'],
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data,
    };

    return responseSuccess(req, res, result);
  },
  // 入库返现列表，导出
  'POST /Inn/exportCashBackList': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: 'http://upload.kuaidihelp.com/inn/cash_back/返现驿站列表202212.xlsx',
    };

    return responseSuccess(req, res, result);
  },
};
